package easyjava;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringDaoDemo {

	public static void main(String[] args) throws SQLException {
		ApplicationContext context =new ClassPathXmlApplicationContext("applicationContext.xml");
		DataSource ds =(DataSource)context.getBean("dataSource");
		System.out.println("connection from dataSource:"+ds.getConnection());
		
		DataSource ds2 =(DataSource)context.getBean("dataSource2");
		System.out.println("connection from dataSource:"+ds.getConnection());
		
		DataSource ds3 =(DataSource)context.getBean("dataSource3");
		System.out.println("connection from dataSource:"+ds.getConnection());
	
	}
}
